import React from "react";
import ReactDOM from "react-dom";
import "./rest.css";
import App from "./router";
import { Provider } from "react-redux";
import store from "./store";

import {auth} from './api'

ReactDOM.render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById("root")
);

if (localStorage.getItem('userInfo')) {
  auth({mid: JSON.parse(localStorage.getItem('userInfo')).id}).then(res => {
    if(res.data.code === 0) {
      localStorage.setItem('auth', JSON.stringify(res.data.data))
    }
  })
}

